<?php include "admin/config/mysql.php";?>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<title>layout后台布局 - Layui</title>
<link rel="stylesheet" href="./layui/css/layui.css">
<link rel="stylesheet" href="css/css1.css">
</head>
<body>
<div class="layui-layout layui-layout-admin">
  <div class="layui-header">
    <!-- 头部区域（可配合layui已有的水平导航） -->
      <div class="maxdiv">
     <div class="header">
     <h1>博客系统首页</h1>
       <?php 
       session_start();
       if(empty($_SESSION["username"])){
        ?>
       <a href="log.php" class="layui-btn ">登入</a>
       <a href="register.php" class="layui-btn ">注册</a>
      <?php
       }
       else{
        ?>            
             <a href="quit.php" class="layui-btn ">退出</a>
             <a href="" class="layui-btn "><?php echo $_SESSION["username"].",欢迎您"?></a>       
       <?php
       }
     ?>      
     </div> 
  </div>
  <div class="layui-side layui-bg-black">
    <?php
    include "public/left.php";
    ?>
  </div>
  <div class="layui-body">
      <ul>
      <?php 
        $kid=empty($_GET["id"])?1:$_GET["id"];
        $re=$pdo->query("select * from article_content where kid=$kid order by id asc");
        $re->setFetchMode(PDO::FETCH_ASSOC);
        $res=$re->fetchALL();
        foreach($res as $val){
      ?>
       <a href="article.php?id=<?php echo $val["id"]?>&&kid=<?php echo $val["kid"]?>"><li><?php echo $val["title"]?></li></a>
       <!-- <a href="article.php?id=1&&uid=2"><li>选项一下面的文章二</li></a>
       <a href="article.php?id=1&&uid=3"><li>选项一下面的文章三</li></a>
       <a href="article.php?id=1&&uid=4"><li>选项一下面的文章四</li></a>
       <a href="article.php?id=1&&uid=5"><li>选项一下面的文章五</li></a>
       <a href="article.php?id=1&&uid=6"><li>选项一下面的文章六</li></a>
       <a href="article.php?id=1&&uid=7"><li>选项一下面的文章七</li></a>
       <a href="article.php?id=1&&uid=8"><li>选项一下面的文章八</li></a> -->
       <?php
         }
       ?>
      </ul>     
  </div>
  <div class="layui-footer">
    <!-- 底部固定区域 -->
  </div>
</div>
<script src="./layui/layui.js"></script>
<script>
//JavaScript代码区域
layui.use('element', function(){
  var element = layui.element(); //导航的hover效果、二级菜单等功能，需要依赖element模块
});
</script>
</body>
</html>